<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Home</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Home</h1>

    



    


    <h3> </h3>










    




    <section>
        <article><h1>LokiJS</h1><p><a href="http://lokijs.org">LokiJS.org web site</a> | 
<a href="https://github.com/techfort/LokiJS">LokiJS GitHub page</a> | 
<a href="https://rawgit.com/techfort/LokiJS/master/examples/sandbox/LokiSandbox.htm">Sandbox / Playground</a></p>
<h2>Documentation Overview</h2><p>This is an early effort to provide a more accurate and up-to-date version of LokiJS documentation by using jsdoc.  Since modifications arise from various contributors, this should allow distributed effort toward 
maintaining this documentation.  </p>
<h2>Getting Started</h2><p>Creating a database :</p>
<pre class="prettyprint source lang-javascript"><code>var db = new loki('example.db');</code></pre><p>Add a collection :</p>
<pre class="prettyprint source lang-javascript"><code>var users = db.addCollection('users');</code></pre><p>Insert documents :</p>
<pre class="prettyprint source lang-javascript"><code>users.insert({
    name: 'Odin',
    age: 50,
    address: 'Asgard'
});

// alternatively, insert array of documents
users.insert([{ name: 'Thor', age: 35}, { name: 'Loki', age: 30}]);</code></pre><p>Simple find query :</p>
<pre class="prettyprint source lang-javascript"><code>var results = users.find({ age: {'$gte': 35} });

var odin = users.findOne({ name:'Odin' });</code></pre><p>Simple where query :</p>
<pre class="prettyprint source lang-javascript"><code>var results = users.where(function(obj) {
    return (obj.age >= 35);
});</code></pre><p>Simple Chaining :</p>
<pre class="prettyprint source lang-javascript"><code>var results = users.chain().find({ age: {'$gte': 35} }).simplesort('name').data();</code></pre><p>Simple named transform :</p>
<pre class="prettyprint source lang-javascript"><code>users.addTransform('progeny', [
  {
    type: 'find',
    value: {
      'age': {'$lte': 40}
    }
  }
]);

var results = users.chain('progeny').data();</code></pre><p>Simple Dynamic View :</p>
<pre class="prettyprint source lang-javascript"><code>var pview = users.addDynamicView('progeny');

pview.applyFind({
    'age': {'$lte': 40}
});

pview.applySimpleSort('name');

var results = pview.data();</code></pre></article>
    </section>






</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Collection.html">Collection</a></li><li><a href="DynamicView.html">DynamicView</a></li><li><a href="Loki.html">Loki</a></li><li><a href="LokiEventEmitter.html">LokiEventEmitter</a></li><li><a href="LokiFsAdapter.html">LokiFsAdapter</a></li><li><a href="LokiFsStructuredAdapter.html">LokiFsStructuredAdapter</a></li><li><a href="LokiIndexedAdapter.html">LokiIndexedAdapter</a></li><li><a href="LokiLocalStorageAdapter.html">LokiLocalStorageAdapter</a></li><li><a href="LokiMemoryAdapter.html">LokiMemoryAdapter</a></li><li><a href="LokiPartitioningAdapter.html">LokiPartitioningAdapter</a></li><li><a href="Resultset.html">Resultset</a></li></ul><h3>Tutorials</h3><ul><li><a href="tutorial-Autoupdating Collections.html">Autoupdating Collections</a></li><li><a href="tutorial-Changes API.html">Changes API</a></li><li><a href="tutorial-Collection Transforms.html">Collection Transforms</a></li><li><a href="tutorial-Indexing and Query performance.html">Indexing and Query performance</a></li><li><a href="tutorial-Loki Angular.html">Loki Angular</a></li><li><a href="tutorial-Persistence Adapters.html">Persistence Adapters</a></li><li><a href="tutorial-Query Examples.html">Query Examples</a></li></ul>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu May 10 2018 03:42:33 GMT-0400 (Eastern Daylight Time)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>